#pragma once
#include "PreInclude.hpp"

class TimeRecordUtil:public Singleton<TimeRecordUtil>
{
public:
	~TimeRecordUtil() override = default;

	//create new record id
	int NewRecord();
	//record a time point
	clock_t MakeRecord(int handler);
	//the time passed since last recorded time point
	clock_t Collapse(int handler);
	//release all record resources about record id
	void CloseRecord(int handler);

	//the average time intervals
	clock_t GetAverage(int handler);
	const std::vector<clock_t>& GetEverRecords(int handler);
private:
	std::map<int, std::vector<clock_t>> _RecordTimePoints;
	std::map<int, std::vector<clock_t>> _RecordTimeIntervals;

	static int _TimeRecordIDAlloactor;
};

